package fr.umlv.m2.jee.spij.service.schedule.report;

import org.richfaces.model.CalendarDataModelItem;

import java.util.HashMap;
import java.util.Map;

/**
 * The calendar data model item that is displayed into a calendar.
 */
public class CalendarDataModelReportItemImpl implements CalendarDataModelItem {

    /**
     * Data iteration.
     */
    private int dataIt = 0;

    /**
     * tag that defines if the item has a tooltip.
     */
    private static final boolean HAS_TOOLTIP = true;

    /**
     * tab that defines if the item is enable.
     */
    private boolean enabled = true;

    /**
     * item styleclass.
     */
    private String styleClass;

    /**
     * Datas.
     */
    private final Map<String, String> data = new HashMap<String, String>();

    /**
     * information tooltip. in test.
     */
    private Object toolTip = "tooltip";

    /**
     * The item day.
     */
    private int day;

    /**
     * @return informs that the item is enable.
     */
    @Override
    public final boolean isEnabled() {
        return enabled;
    }

    /**
     * @return the style class.
     */
    @Override
    public final String getStyleClass() {
        return styleClass;
    }

    /**
     * @return the data that is displayed.
     */
    @Override
    public final Object getData() {
        return data;
    }

    /**
     * @return informs if the item has a tooltip.
     */
    @Override
    public final boolean hasToolTip() {
        return HAS_TOOLTIP;
    }

    /**
     * @return the tooltip.
     */
    @Override
    public final Object getToolTip() {
        return toolTip;
    }

    /**
     * @return the item day.
     */
    @Override
    public final int getDay() {
        return day;
    }

    /**
     * @param newDay the new day to set.
     */
    public final void setDay(final int newDay) {
        this.day = newDay;
    }

    /**
     * @param newEnabled the new tag to set.
     */
    public final void setEnabled(final boolean newEnabled) {
        this.enabled = newEnabled;
    }

    /**
     * @param newStyleClass the new value to set.
     */
    public final void setStyleClass(final String newStyleClass) {
        this.styleClass = newStyleClass;
    }

    /**
     * @param subject the subject to add into the data.
     */
    public final void addData(final String subject) {
        ++dataIt;
        data.put(Integer.toString(dataIt), subject);
    }
}
